package edu.sctu.wangxiaoqiang.day20150614;

import java.io.File;
import java.io.IOException;
import java.io.Writer;

/**
 * Created by user25 on 2015/6/14.
 */
public class FileSet {

    public void setFile(String path){
        File file = new File(path);
        if (!file.exists()){
            file.mkdir();
        }
    }

    public void setNewFile(String newfile){
        File file = new File(newfile);
        if (!file.exists()){
            try {
                file.createNewFile();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }

    }

    public void deleteFile(String dfile){
        File file = new File(dfile);
        file.delete();

    }

    public String isFile(String isfile){
        String a;
        File file = new File(isfile);
        if (file.isFile()){
            a = "ture";
        }else {
            a = "false";
        }
        return a;
    }

    public void method(String getfile){
        File file = new File(getfile);
        Writer writer = new Writer() {
            @Override
            public void write(char[] cbuf, int off, int len) throws IOException {

            }

            @Override
            public void flush() throws IOException {

            }

            @Override
            public void close() throws IOException {

            }
        };

    }
}
